package com.hongning.railway.ui.main.fragments.home.itemviewmodel;

import android.databinding.ObservableField;
import android.os.Bundle;
import android.support.annotation.NonNull;

import com.hongning.railway.entity.resbean.NewsCategoryBean;
import com.hongning.railway.ui.categorylistnews.CategoryListNewsFragment;
import com.hongning.railway.ui.main.fragments.home.HomeViewModel;

import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.utils.ToastUtils;

public class GirdItemViewModel extends ItemViewModel<HomeViewModel> {
    public ObservableField<NewsCategoryBean> item=new ObservableField<>();


    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putParcelable(CategoryListNewsFragment.PARAMS_CATEGORY_ID,item.get());
            viewModel.startContainerActivity(CategoryListNewsFragment.class.getCanonicalName(),bundle);
        }
    });
    public GirdItemViewModel(@NonNull HomeViewModel viewModel, NewsCategoryBean item) {
        super(viewModel);
        this.item.set(item);
    }

}

